#pragma once

#include "IPayload.h"

namespace RoomFW {

//
// Class:	IContractChecker
//
// Description:	Contract Checker interface.
//
// Author:	Andrew Sage
//
struct IContractChecker;
typedef ::boost::shared_ptr<const IContractChecker> IContractCheckerSPC;
struct IContractChecker
{
	//
	// Method:	~IContractChecker
	//
	// Description:	Virtual destructor to ensure derived class destructors called.
	//
	virtual ~IContractChecker() {};

	//
	// Method:	validMessage
	//
	// Description:	Determine if a message id and payload combination
	//				is valid for this contract.
	//
	// Parameters:
	//
	//	messageID - Message ID to check.
	//
	//	payload - Message payload to check.
	//
	// Return:	True if it's a valid message.
	//
	virtual bool validMessage(MessageID messageID, const IPayloadSP& payload) const = 0;

	//
	// Method:	messageName
	//
	// Description:	Return the message name.
	//
	// Parameters:
	//
	//	messageID - Message ID to get name for.
	//
	// Return:	Message name.
	//
	virtual const char* messageName(MessageID messageID) const = 0;

	//
	// Method:	getTypeID
	//
	// Description:	Get the contract type id for this class.
	//
	// Parameters:	None
	//
	// Return:	The contract type id for this class.
	//
	virtual ContractTypeId getTypeID() const = 0;

	//
	// Method:	isConjugate
	//
	// Description:	Get conjugate flag for this object.
	//
	// Parameters:	None
	//
	// Return:	Conjugate flag for this object.
	//
	virtual bool isConjugate() const = 0;

	//
	// Method:	getIsLogged
	//
	// Description:	Get a flag to indicate if messages check by this
	//				instance should be logged.
	//
	// Parameters:	None
	//
	// Return:	IsLogged flag.
	//
	virtual bool getIsLogged() const = 0;

	//
	// Method:	setIsLogged
	//
	// Description:	Set a flag to indicate if messages check by this
	//				instance should be logged.
	//
	// Parameters:	IsLogged flag.
	//
	// Return:	None.
	//
	virtual void setIsLogged(bool isLogged) const = 0; //This shouldn't be const, but all our access to contract checkers
													   //is const and we need to be able to change this flag...

	//
	// Method:	getConjugate
	//
	// Description:	Get a conjugated copy of this object.
	//
	// Parameters:	None
	//
	// Return:	A conjugated copy of this object.
	//
	virtual IContractCheckerSPC getConjugate() const = 0;

	//
	// Method:	createPayload
	//
	// Description:	Create a payload object for a given message id.
	//
	// Parameters:
	//
	//	messageID - Message ID to create payload for.
	//
	// Return:	Payload or null if error.
	//
	virtual IPayloadSP createPayload(MessageID messageID) const = 0;
};

}
